const { network } = require('hardhat');

module.exports = async ({ getNamedAccounts, deployments }) => {
    const { deploy, log } = deployments
    const { deployer } = await getNamedAccounts()
    const chainId = network.config.chainId
    if (chainId == 31337) {
        log("----------------------------------------------------")
        log("Deploying BehaviorCheck and waiting for confirmations...")
        const behaviorcheck = await deploy("BehaviorCheck", {
            from: deployer,
            args: [],
            log: true,
            // we need to wait if on a live network so we can verify properly
            waitConfirmations: network.config.blockConfirmations || 1,
    })
    log(`BehaviorCheck deployed at ${behaviorcheck.address}`)
    log(network.config)
    }

}

module.exports.tags = ["all", "BehaviorCheck"]